/* Y o u r   D e s c r i p t i o n                       */
/*                            AppBuilder Photon Code Lib */
/*                                         Version 1.14C */

/* Standard headers */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

/* Toolkit headers */
#include <Ph.h>
#include <Pt.h>
#include <Ap.h>

/* Local headers */
#include "ph_toolBar.h"
#include "abimport.h"
#include "proto.h"

extern char toolBarTitle[128];

int init( PtWidget_t *link_instance, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	PtArg_t arg;
	int value;

	/* eliminate 'unreferenced' warnings */
	link_instance = link_instance, apinfo = apinfo, cbinfo = cbinfo;

	/* get the initial state of the paradigm switch */
	PtSetArg(&arg, Pt_ARG_ONOFF_STATE, 0, 0);
	PtGetResources(ABW_pdigmOnOffButton, 1, &arg);
	value = (int)arg.value;
	if(value) {
		i_b->i_flags &= ~I_PSTOP;
		softswitch &= ~PSTOP;
	}
	else {
		i_b->i_flags |= I_PSTOP;
		softswitch |= PSTOP;
	}

	/* get the initial state of the window check */
	PtSetArg(&arg, Pt_ARG_ONOFF_STATE, 0, 0);
	PtGetResources(ABW_windowsOnOffButton, 1, &arg);
	value = (int)arg.value;
	if(value) i_b->i_flags &= ~I_WINOFF;
	else i_b->i_flags |= I_WINOFF;

	/* set the title of the main window */
	PtSetArg(&arg, Pt_ARG_WINDOW_TITLE, toolBarTitle, 0);
	PtSetResources(link_instance, 1, &arg);

	return( Pt_CONTINUE );
}

